<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html lang="en">
<head>
<title>用户操作记录管理</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	
	<link rel="icon" href="favicon.ico" type="image/x-icon" />
	<!-- END META SECTION -->
	
	<!-- CSS INCLUDE -->        
	      
	<link rel="stylesheet" href="${ctx}/rs/js/zTree/css/zTreeStyle/metro.css"/>
	<link rel="stylesheet" href="${ctx}/rs/css/bootstrap-table.css" />
	<link rel="stylesheet" href="${ctx}/rs/css/main.css" />
	<link id="theme" rel="stylesheet" href="${ctx}/rs/joli/css/theme-default.css" />
	
	<!-- EOF CSS INCLUDE -->        
</head>
<body>
	<!-- START PAGE CONTAINER -->
      <div class="page-container">
      	<!-- 引入左菜单部分 -->
          <jsp:include page="../joli/menu.jsp"></jsp:include>
          
          <!-- START PAGE CONTENT -->
          <div class="page-content">
              <jsp:include page="../joli/top.jsp"></jsp:include>
              
              <!-- START BREADCRUMB -->
              <ul class="breadcrumb">
                  <li><a href="#">系统管理  </a></li>                    
                  <li class="active">用户操作记录管理</li>
              </ul>
              <!-- END BREADCRUMB -->   
              
              
              <!-- PAGE CONTENT WRAPPER -->
              <div class="page-content-wrap">
              	<div class="row">
		           		<div class="col-xs-12">
		           			<div id="toolbar">
							    <div class="fr pb10">
								   <input type="text" class="srt-put1 mr10 widput1" id="key" name="key"/>
								   <button class="btn btn-primary btn-sm srt-btn active" onclick="refresh()">搜索</button>
							    </div>
							</div>
							<table id="table" cellpadding="0" cellspacing="0" data-toggle="table" data-toolbar="#toolbar"
								data-url="${ctx}/log/page.htm"
								data-cache="false"
								data-pagination="true" 
								data-side-pagination="server"
								data-page-list="[10, 20, 50, 100]"
								data-page-size="20"  
								data-query-params="queryParams">
								<thead>
									<tr class="tab-th">
										<th data-field="id">编号</th>
										<th data-field="userName">登录账户</th>
										<th class="col-md-2" data-field="oper">用户操作</th>
										<th class="col-md-3" data-field="path">操作路径</th>
										<th class="col-md-1" data-field="ip">访问ip地址</th>
										<th class="col-md-2" data-field="url">请求地址</th>
										<th data-field="type">请求类型</th>
					<!-- 				<th data-field="param">请求参数</th> -->
										<th data-field="createTime" data-formatter="timeFormatter">操作时间</th>
									</tr>
								</thead>
							</table>
           		</div>
           	</div>
       </div>
   	</div>

	<!-- 引入所有joli的脚本 -->
	<jsp:include page="../joli/scripts.jsp"></jsp:include>
	<!-- 引入页面需要的脚本 -->
	<script type="text/javascript" src="${ctx}/rs/js/bootstrapQ.min.js"></script>
	<script src="${ctx}/rs/js/zTree/js/jquery.ztree.all-3.5.min.js"></script>
	<script src="${ctx}/rs/js/bootstrap-table.js"></script>
	<script src="${ctx}/rs/js/bootstrap-table-zh-CN.js"></script>
	<script src="${ctx}/rs/js/jquery.formatDate.js"></script>
	<script src="${ctx}/rs/js/my97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="${ctx}/rs/js/session-out-error.js"></script>
	<script>
		activeMenu($("#menu_sys_3"));
	    var $table = $('#table');
	    $table.bootstrapTable({
            height: getHeight()
        });
	    
	    function getHeight() {
	        return window.screen.height - 348;
	    }
	    
	    $(window).resize(function () {
        	$table.bootstrapTable('resetView',{height: getHeight()});
        });
	    //初始化刷新
	    function refresh(){
	    	var key = $("#key").val();
	        var pageSize = $table.bootstrapTable('getOptions').pageSize;
	    	$table.bootstrapTable('refresh', {
	    		silent: true,
	    		cache : false,
                url: '${ctx}/log/page.htm',
                query: {
                	userName : key,
    				pageIndex : 0,
    				pageSize : pageSize
    			}
            });
	    }
	    
		function queryParams(params) {
			var key = $("#key").val();
			return {
				userName : key,
				pageIndex : params.offset,
				pageSize : params.limit
			};
		}
		
		function timeFormatter(value, row, index){
			 if(value){
				 return value;
			 }
			 return "--";
		}

	</script>
</body>
</html>